package com.delistry.server.clientpacket;

import static com.delistry.server.clientpacket.ClientOpcodes.C_Login;
import static com.delistry.server.clientpacket.ClientOpcodes.Sep;

import com.delistry.server.ClientProcess;
import com.delistry.server.utils.PacketUtil;

public class LoginPacketProcess extends ClientPacketProcess {

	public LoginPacketProcess() {
		super(C_Login);
	}

	protected void HandleClientPacket() {
		ClientPacket clientPacket = PeekData();
		if (clientPacket == null)
			return;

		ClientProcess client = clientPacket.getClient();
		String packet = clientPacket.getPacket();

		//get packet key
		int lastIndex = packet.split(Sep).length - 1;
		String key = packet.split(Sep)[lastIndex];
		
		//TODO packet stuff ... work in progress...
		
		//convert to return packet
		String ret = PacketUtil.ToPacket(String.valueOf(getOP()),"true", key);
		
		client.SendClientPacket(ret);

		System.out.println(ret);
	}

}
